package IOBaseTest;

import java.io.FileWriter;
import java.io.IOException;

/**
 * Created by yexuan on 2018/3/11.
 */
public class FileWriterDemo2 {
    public static void main(String[] args){
        FileWriter fw = null;
        try {
            //传true，代表不覆盖已有文件，并在已有文件末尾处进行数据续写
            fw = new FileWriter("demo.txt",true);

            fw.write("\r\nxiexie"); //     \r\n 换行
//            fw.write(new char[]{'a','x'});
        }catch (IOException e){
            System.out.println(e.toString());
        }finally {
            if(fw!=null)
                try {
                    fw.close();
                } catch (IOException e) {
                    System.out.println(e.toString());
                }
        }

    }
}
